<?php
include_once("config.php"); //mei94.com
//判断题1分，单选题2分 不定项选择题 3分

$fenshu=0;

$table='c3_log_c1';

$sql="select * from ".$table." where fen is NULL limit 0, 4";
$query=$mysqli->query($sql);
while ($getc3=$query->fetch_assoc()){
     $ida=json_decode($getc3['ida'],true);
     $udA=json_decode($getc3['d1'],true);
     foreach ($ida as $k=>$id){
         $getDan=$udA[$k];
         if (!empty($getDan) && $daAn[$id]['d'] == $getDan){
             $fenshu++;
         }
     }
     
     $idb=json_decode($getc3['idb'],true);
     $udB=json_decode($getc3['d2'],true);
     if (!empty($idb)){
         foreach ($idb as $k=>$id){
             $getDan=$udB[$k];
             if (!empty($getDan) && $daAn[$id]['d'] == $getDan){
                 $fenshu++;
                 $fenshu++;
             }
         }
     }
     
     
     echo "<br /><br />";
     $idc=json_decode($getc3['idc'],true);
     $udC=json_decode($getc3['d3'],true);
     if (!empty($idc)){
         foreach ($idc as $k=>$id){
             $getDan=explode(',', $udC[$k]);
             $getDanB=explode(',', $daAn[$id]['d']);
             $isequal=true;
             $getNum1=count($getDan);
             $getNum2=count($getDanB);
             if ($getNum1 != $getNum2){
                 $isequal=false;
             }
             if (true == $isequal){
                 foreach ($getDanB as $v){
                     $tmpZM=trim($v);
                     if (!in_array($tmpZM, $getDan))
                     {
                         $isequal=false;
                     }
                 }
             }
             if (true == $isequal){
                 $fenshu++;
                 $fenshu++;
                 $fenshu++;
                 //echo '==:',$udC[$k];
                 //echo "<br /><br />";
             }

         }
     }
     echo "<br /><br />";
     echo $getc3['id'], ':',$fenshu;
   
     $mysqli->query("update ".$table." set fen=".$fenshu." where id='".$getc3['id']."'  ");
     
    
}

$mysqli->close();

?>
<script>
window.setTimeout(function(){
	location.reload();
},400);
</script>


